﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections;

namespace TouchUmlUI
{
    public class DrawObject
    {

        public List<Polyline> lines;
        public OurCanvas panel = null;
        private Polyline tmpline;

        public DrawObject()
        {
            lines = new List<Polyline>();
            lines.Clear();
        }

        public void UpdateOnCanvas()
        {
            Remove();
            foreach (Polyline l in lines)
            {
                panel.Children.Add(l);
            }
        }

        public void Remove()
        {
            foreach (Polyline l in lines) {
                panel.Children.Remove(l);
            }
        }

        public void NewLine()
        {
            tmpline = new Polyline();
            tmpline.Stroke = Brushes.Black;
            tmpline.StrokeThickness = 1;
            lines.Add(tmpline);
        }

        public void AddPoint(double px, double py)
        {
            tmpline.Points.Add(new Point(px, py));
        }

        public void AddLine()
        {            
            NewLine();
            UpdateOnCanvas();
        }

    }
}
